package com.ingsing.common.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author houg
 * @create 2019/10/20 15:21
 * @explain 时间处理类
 */
public class TimeUtils {
    //获取当前时间（数据库 datetime 格式 ）
    public java.sql.Timestamp getCurrentTime(){
        Date systemTime = new Date();
        SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String current =  time.format(systemTime);
        Date date = null;
        try {
            date = time.parse(current);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        java.sql.Timestamp dateSQL = new java.sql.Timestamp(date.getTime());
        return dateSQL;
    }

}
